package com.sgcc.ln.pmos.mobileapp.activity;


import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.ln.pmos.arouter.app.AppArouterPath;
import com.sgcc.ln.pmos.common.base.BasePresenter;
import com.sgcc.ln.pmos.common.base.MvpBaseActivity;
import com.sgcc.ln.pmos.common.utils.UserManager;
import com.sgcc.ln.pmos.common.widget.TitleBar;

@Route(path = AppArouterPath.APP_AUDITSTATEACTIVITY)
public class AuditStateActivity extends MvpBaseActivity {

    @Autowired
    public int position;

    @Autowired
    public String text;

    private TitleBar titleBar;
    private ImageView imgState;
    private TextView tvTitleHint;
    private TextView tvContentHint;
    private TextView tvBtn1;
    private TextView tvBtn;


    @Override
    protected int getContentViewLayoutID() {
        return R.layout.activity_audit_state;
    }


    @Override
    protected BasePresenter createPresenter() {
        return null;
    }


    @Override
    protected void initViews() {
        super.initViews();
        titleBar = findViewById(R.id.title_bar);
        imgState = findViewById(R.id.imgState);
        tvTitleHint = findViewById(R.id.tvTitleHint);
        tvContentHint = findViewById(R.id.tvContentHint);
        tvBtn1 = findViewById(R.id.tvBtn1);
        tvBtn = findViewById(R.id.tvBtn);

        titleBar.setTitle("企业信息审核中");

        titleBar.setRightIcon(R.mipmap.go_main, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                goMainActivity();
            }
        });


        imgState.setImageResource(position == 6 ? R.mipmap.ic_audit_6 : R.mipmap.ic_audit_8);
        tvTitleHint.setText(position == 6 ? "审核中" : "审核驳回");
        tvContentHint.setText(position == 6 ? "企业信息正在审核中，请耐心等待" : "审批意见:" + text);
        tvBtn1.setVisibility(position == 6 ? View.GONE : View.VISIBLE);

        tvBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                UserManager.logout();
                goMainActivity();
            }
        });

        tvBtn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ARouter.getInstance()
                        .build(AppArouterPath.APP_ASSOCIATEDENTERPRISEINFO)
                        .withString("position", "0")
                        .navigation();
            }
        });

    }
}